package com.zlp.enums;

import lombok.Getter;

/**
 * 供应商类型
 * @author ZouLiPing
 * @date 2022/8/17 10:27
 */
@Getter
public enum SupplierTypeEnum {

    NON("非供应商商品",1000),
    LI_HAN("力翰",2000),
    YUNSHENG_FUTURE("云生未来",3000)
    ;
    private String name;
    private Integer code;


    SupplierTypeEnum(String name, Integer code) {
        this.name = name;
        this.code = code;
    }


    /**
     * 根据code获取name
     */
    public static String getName(Integer code) {
        for (SupplierTypeEnum supplierTypeEnum : SupplierTypeEnum.values()) {
            if (supplierTypeEnum.getCode().equals(code)) {
                return supplierTypeEnum.getName();
            }
        }
        return null;
    }

}